package com.dream.utils;

import java.lang.reflect.Field;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author Linl
 * @since 2021/8/7 17:42
 */
public class Check {

    public static <T> Map<String,Object> check(Object obj) throws Exception {
        Class<?> tClass = obj.getClass();
        Map<String, Object> map = new ConcurrentHashMap<>();
        Field[] declaredFields = tClass.getDeclaredFields();
        for (Field field:declaredFields) {
            field.setAccessible(true);
            System.out.println(field.getName());
            Object o = field.get(obj);
            if (o != null) {
                map.put(field.getName(),o);
            }
        }
        return map;
    }


}
